﻿USE [FutSADataBase]
GO
/****** Object:  Table [dbo].[CampenatoModelo]    Script Date: 08/12/2008 22:58:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CampenatoModelo](
	[CampeonatoModeloID] [int] IDENTITY(1,1) NOT NULL,
	[Nome] [varchar](100) NULL,
 CONSTRAINT [PK_CampenatoModelo] PRIMARY KEY CLUSTERED 
(
	[CampeonatoModeloID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[TimeMascote]    Script Date: 08/12/2008 22:59:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TimeMascote](
	[TimeMascoteID] [int] IDENTITY(1,1) NOT NULL,
	[Nome] [varchar](100) NOT NULL,
	[ImagemUrl] [varchar](500) NOT NULL,
 CONSTRAINT [PK_TimeMascote] PRIMARY KEY CLUSTERED 
(
	[TimeMascoteID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[TimeEmblema]    Script Date: 08/12/2008 22:59:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TimeEmblema](
	[TimeEmblemaID] [int] IDENTITY(1,1) NOT NULL,
	[Nome] [varchar](100) NOT NULL,
	[ImagemUrl] [varchar](500) NOT NULL,
 CONSTRAINT [PK_TimeEmblema] PRIMARY KEY CLUSTERED 
(
	[TimeEmblemaID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Posicao]    Script Date: 08/12/2008 22:58:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Posicao](
	[PosicaoID] [int] IDENTITY(1,1) NOT NULL,
	[Nome] [varchar](50) NOT NULL,
 CONSTRAINT [PK_Posicao] PRIMARY KEY CLUSTERED 
(
	[PosicaoID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Calendario]    Script Date: 08/12/2008 22:58:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Calendario](
	[CalendarioID] [int] IDENTITY(1,1) NOT NULL,
	[DataInicio] [datetime] NOT NULL,
	[DataFim] [datetime] NOT NULL,
 CONSTRAINT [PK_Calendario] PRIMARY KEY CLUSTERED 
(
	[CalendarioID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Usuario]    Script Date: 08/12/2008 22:59:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Usuario](
	[UsuarioID] [int] IDENTITY(1,1) NOT NULL,
	[UserName] [varchar](50) NOT NULL,
	[Password] [varchar](50) NOT NULL,
 CONSTRAINT [PK_Usuario] PRIMARY KEY CLUSTERED 
(
	[UsuarioID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Nota]    Script Date: 08/12/2008 22:58:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Nota](
	[NotaID] [bigint] IDENTITY(1,1) NOT NULL,
	[UsuarioID] [nchar](10) NOT NULL,
	[RelacaoID] [int] NOT NULL,
	[NotaTipo] [int] NOT NULL,
	[Valor] [decimal](3, 1) NOT NULL,
	[Cometario] [varchar](8000) NOT NULL,
	[Dia] [datetime] NULL CONSTRAINT [DF_Nota_Dia]  DEFAULT (getdate()),
	[Final] [bit] NOT NULL,
 CONSTRAINT [PK_Nota] PRIMARY KEY CLUSTERED 
(
	[NotaID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Video]    Script Date: 08/12/2008 22:59:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Video](
	[VideoID] [int] IDENTITY(1,1) NOT NULL,
	[UsuarioID] [int] NOT NULL,
	[VideoTipo] [int] NOT NULL,
	[RelacaoID] [int] NOT NULL,
	[Html] [text] NOT NULL,
	[Descricao] [varchar](500) NOT NULL,
 CONSTRAINT [PK_Video] PRIMARY KEY CLUSTERED 
(
	[VideoID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Error]    Script Date: 08/12/2008 22:58:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Error](
	[ErrorID] [bigint] IDENTITY(1,1) NOT NULL,
	[ErrorData] [varchar](8000) NOT NULL,
	[ErrorType] [varchar](8000) NOT NULL,
	[Dia] [datetime] NOT NULL,
	[UserID] [int] NOT NULL,
 CONSTRAINT [PK_Error] PRIMARY KEY CLUSTERED 
(
	[ErrorID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Log]    Script Date: 08/12/2008 22:58:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Log](
	[LogID] [bigint] IDENTITY(1,1) NOT NULL,
	[LogData] [varchar](8000) NOT NULL,
	[LogType] [varchar](8000) NOT NULL,
	[Dia] [datetime] NOT NULL,
	[UserID] [int] NOT NULL,
 CONSTRAINT [PK_Log] PRIMARY KEY CLUSTERED 
(
	[LogID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[CampeonatoTipo]    Script Date: 08/12/2008 22:58:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CampeonatoTipo](
	[CampeonatoTipoID] [int] IDENTITY(1,1) NOT NULL,
	[Nome] [varchar](50) NULL,
	[Descricao] [varchar](200) NULL,
 CONSTRAINT [PK_CampeonatoTipo] PRIMARY KEY CLUSTERED 
(
	[CampeonatoTipoID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Campeonato]    Script Date: 08/12/2008 22:58:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Campeonato](
	[CampeonatoID] [int] IDENTITY(1,1) NOT NULL,
	[CampeonatoTipoID] [int] NOT NULL,
	[CampenatoModeloID] [int] NOT NULL,
	[Descricao] [text] NULL,
	[CalendarioID] [int] NOT NULL,
	[PaisID] [int] NOT NULL,
	[EstadoID] [int] NOT NULL,
	[Status] [int] NOT NULL,
 CONSTRAINT [PK_Campeonato] PRIMARY KEY CLUSTERED 
(
	[CampeonatoID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Partida]    Script Date: 08/12/2008 22:58:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Partida](
	[PartidaID] [int] IDENTITY(1,1) NOT NULL,
	[CampeonatoID] [int] NOT NULL,
	[TimeCasaID] [int] NOT NULL,
	[TimeVisitanteID] [int] NOT NULL,
	[CalendarioItemID] [int] NOT NULL,
	[GolCasa] [smallint] NOT NULL,
	[GolVisitante] [smallint] NOT NULL,
	[Status] [int] NOT NULL,
 CONSTRAINT [PK_Partida] PRIMARY KEY NONCLUSTERED 
(
	[CampeonatoID] ASC,
	[TimeCasaID] ASC,
	[TimeVisitanteID] ASC,
	[CalendarioItemID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CampeonatoTime]    Script Date: 08/12/2008 22:58:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CampeonatoTime](
	[CampeonatoTimeID] [int] IDENTITY(1,1) NOT NULL,
	[CampeonatoID] [int] NOT NULL,
	[TimeID] [int] NOT NULL,
 CONSTRAINT [PK_CampeonatoTimes] PRIMARY KEY CLUSTERED 
(
	[CampeonatoID] ASC,
	[TimeID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TimeProfissional]    Script Date: 08/12/2008 22:59:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TimeProfissional](
	[TimeProfissionalID] [int] IDENTITY(1,1) NOT NULL,
	[TimeID] [int] NOT NULL,
	[ProfissionalID] [int] NOT NULL,
	[DataInicio] [datetime] NOT NULL,
	[DataFim] [datetime] NOT NULL,
	[Status] [int] NOT NULL,
	[CamisaNr] [varchar](10) NULL,
 CONSTRAINT [PK_TimeProfissional] PRIMARY KEY CLUSTERED 
(
	[TimeID] ASC,
	[ProfissionalID] ASC,
	[DataInicio] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Time]    Script Date: 08/12/2008 22:59:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Time](
	[TimeID] [int] IDENTITY(1,1) NOT NULL,
	[Sigla] [varchar](5) NOT NULL,
	[Nome] [varchar](200) NOT NULL,
	[Apelido] [varchar](100) NULL,
	[DataFundacao] [smalldatetime] NOT NULL,
	[Endereco] [text] NOT NULL,
	[EstadioID] [int] NOT NULL,
	[SiteOficial] [text] NOT NULL,
	[TimeEmblemaID] [int] NOT NULL,
	[TimeMascoteID] [int] NOT NULL,
 CONSTRAINT [PK_Time] PRIMARY KEY CLUSTERED 
(
	[TimeID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[PartidaProfissional]    Script Date: 08/12/2008 22:58:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PartidaProfissional](
	[PartidaProfissionalID] [int] IDENTITY(1,1) NOT NULL,
	[PartidaID] [int] NOT NULL,
	[ProfissionalID] [int] NOT NULL,
	[Nota] [decimal](3, 1) NOT NULL,
 CONSTRAINT [PK_PartidaProfissional] PRIMARY KEY CLUSTERED 
(
	[PartidaID] ASC,
	[ProfissionalID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Profissional]    Script Date: 08/12/2008 22:59:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Profissional](
	[ProfissionalID] [int] IDENTITY(1,1) NOT NULL,
	[ProfissionalTipoID] [int] NOT NULL,
	[Nome] [varchar](100) NOT NULL,
	[Apelido] [varchar](50) NULL,
	[DataNascimento] [smalldatetime] NOT NULL,
	[LocalNascimento] [varchar](100) NULL,
	[Altura] [decimal](4, 2) NOT NULL,
	[Peso] [decimal](5, 2) NOT NULL,
	[PosicaoID] [int] NOT NULL,
 CONSTRAINT [PK_Profissional] PRIMARY KEY CLUSTERED 
(
	[ProfissionalID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[CalendarioItem]    Script Date: 08/12/2008 22:58:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CalendarioItem](
	[CalendarioItemID] [int] IDENTITY(1,1) NOT NULL,
	[CalendarioID] [int] NOT NULL,
	[Data] [datetime] NOT NULL,
 CONSTRAINT [PK_CalendarioItem] PRIMARY KEY NONCLUSTERED 
(
	[CalendarioID] ASC,
	[Data] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY],
 CONSTRAINT [IX_CalendarioItem] UNIQUE CLUSTERED 
(
	[CalendarioItemID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PartidaGol]    Script Date: 08/12/2008 22:58:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[PartidaGol](
	[PartidaGolID] [int] IDENTITY(1,1) NOT NULL,
	[PartidaID] [int] NOT NULL,
	[ProfissionalID] [int] NOT NULL,
	[TempoOcorrido] [varchar](8) NOT NULL,
	[Tempo] [char](1) NOT NULL,
 CONSTRAINT [PK_PartidaGol] PRIMARY KEY CLUSTERED 
(
	[PartidaID] ASC,
	[ProfissionalID] ASC,
	[TempoOcorrido] ASC,
	[Tempo] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[PartidaCartao]    Script Date: 08/12/2008 22:58:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[PartidaCartao](
	[PartidaCartaoID] [int] IDENTITY(1,1) NOT NULL,
	[PartidaID] [int] NOT NULL,
	[TimeID] [int] NOT NULL,
	[ProssionalID] [int] NOT NULL,
	[CartaoTipo] [char](1) NOT NULL,
 CONSTRAINT [PK_PartidaCartao] PRIMARY KEY CLUSTERED 
(
	[PartidaID] ASC,
	[TimeID] ASC,
	[ProssionalID] ASC,
	[CartaoTipo] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  StoredProcedure [dbo].[spCampeonatoPorID]    Script Date: 08/12/2008 22:59:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[spCampeonatoPorID]
(
	@CampeonatoID int
)
AS
	SET NOCOUNT ON;
SELECT CampeonatoID,CampeonatoTipoID, CampenatoModeloID, Descricao, CalendarioID, PaisID, EstadoID, Status FROM dbo.Campeonato Where CampeonatoID=@CampeonatoID
GO
/****** Object:  StoredProcedure [dbo].[spTimePorID]    Script Date: 08/12/2008 22:59:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[spTimePorID]
(
	@TimeID int
)
AS
	SET NOCOUNT ON;
SELECT TimeID, Sigla, Nome, Apelido, DataFundacao, Endereco, EstadioID, SiteOficial, TimeEmblemaID, TimeMascoteID FROM dbo.Time Where TimeID=@TimeID
GO
/****** Object:  StoredProcedure [dbo].[spTimeEmblemaPorID]    Script Date: 08/12/2008 22:59:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[spTimeEmblemaPorID]
(
	@TimeEmblemaID int
)
AS
	SET NOCOUNT ON;
SELECT TimeEmblemaID, Nome, ImagemUrl FROM dbo.TimeEmblema Where TimeEmblemaID=@TimeEmblemaID
GO
/****** Object:  StoredProcedure [dbo].[ProfissionalPorPartida]    Script Date: 08/12/2008 22:59:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[ProfissionalPorPartida]
(
	@Partida int
)
AS
	SET NOCOUNT ON;
SELECT ProfissionalID, ProfissionalTipoID, Nome, Apelido, DataNascimento, LocalNascimento, Altura, Peso, PosicaoID FROM dbo.Profissional WHERE ProfissionalID IN (SELECT ProfissionalID FROM PartidaProfissional WHERE PartidaID=@Partida)
GO
/****** Object:  StoredProcedure [dbo].[VideoPorRelacao]    Script Date: 08/12/2008 22:59:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[VideoPorRelacao]
(
	@VideoTipo int,
	@RelacaoID int
)
AS
	SET NOCOUNT ON;
SELECT VideoID, UsuarioID, VideoTipo, RelacaoID, Html, Descricao FROM dbo.Video WHERE VideoTipo=@VideoTipo AND RelacaoID=@RelacaoID
GO
/****** Object:  StoredProcedure [dbo].[spErrorPorID]    Script Date: 08/12/2008 22:59:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[spErrorPorID]
(
	@ErrorID bigint
)
AS
	SET NOCOUNT ON;
SELECT ErrorID, ErrorData, ErrorType, Dia, UserID FROM dbo.Error Where ErrorID=@ErrorID
GO
/****** Object:  ForeignKey [FK_CalendarioItem_Calendario]    Script Date: 08/12/2008 22:58:59 ******/
ALTER TABLE [dbo].[CalendarioItem]  WITH CHECK ADD  CONSTRAINT [FK_CalendarioItem_Calendario] FOREIGN KEY([CalendarioID])
REFERENCES [dbo].[Calendario] ([CalendarioID])
GO
ALTER TABLE [dbo].[CalendarioItem] CHECK CONSTRAINT [FK_CalendarioItem_Calendario]
GO
/****** Object:  ForeignKey [FK_Campeonato_Calendario]    Script Date: 08/12/2008 22:58:59 ******/
ALTER TABLE [dbo].[Campeonato]  WITH CHECK ADD  CONSTRAINT [FK_Campeonato_Calendario] FOREIGN KEY([CalendarioID])
REFERENCES [dbo].[Calendario] ([CalendarioID])
GO
ALTER TABLE [dbo].[Campeonato] CHECK CONSTRAINT [FK_Campeonato_Calendario]
GO
/****** Object:  ForeignKey [FK_Campeonato_CampenatoModelo]    Script Date: 08/12/2008 22:58:59 ******/
ALTER TABLE [dbo].[Campeonato]  WITH CHECK ADD  CONSTRAINT [FK_Campeonato_CampenatoModelo] FOREIGN KEY([CampenatoModeloID])
REFERENCES [dbo].[CampenatoModelo] ([CampeonatoModeloID])
GO
ALTER TABLE [dbo].[Campeonato] CHECK CONSTRAINT [FK_Campeonato_CampenatoModelo]
GO
/****** Object:  ForeignKey [FK_Campeonato_CampeonatoTipo]    Script Date: 08/12/2008 22:58:59 ******/
ALTER TABLE [dbo].[Campeonato]  WITH CHECK ADD  CONSTRAINT [FK_Campeonato_CampeonatoTipo] FOREIGN KEY([CampeonatoTipoID])
REFERENCES [dbo].[CampeonatoTipo] ([CampeonatoTipoID])
GO
ALTER TABLE [dbo].[Campeonato] CHECK CONSTRAINT [FK_Campeonato_CampeonatoTipo]
GO
/****** Object:  ForeignKey [FK_CampeonatoTime_Campeonato]    Script Date: 08/12/2008 22:58:59 ******/
ALTER TABLE [dbo].[CampeonatoTime]  WITH CHECK ADD  CONSTRAINT [FK_CampeonatoTime_Campeonato] FOREIGN KEY([CampeonatoID])
REFERENCES [dbo].[Campeonato] ([CampeonatoID])
GO
ALTER TABLE [dbo].[CampeonatoTime] CHECK CONSTRAINT [FK_CampeonatoTime_Campeonato]
GO
/****** Object:  ForeignKey [FK_CampeonatoTime_Time]    Script Date: 08/12/2008 22:58:59 ******/
ALTER TABLE [dbo].[CampeonatoTime]  WITH CHECK ADD  CONSTRAINT [FK_CampeonatoTime_Time] FOREIGN KEY([TimeID])
REFERENCES [dbo].[Time] ([TimeID])
GO
ALTER TABLE [dbo].[CampeonatoTime] CHECK CONSTRAINT [FK_CampeonatoTime_Time]
GO
/****** Object:  ForeignKey [FK_Partida_CalendarioItem]    Script Date: 08/12/2008 22:58:59 ******/
ALTER TABLE [dbo].[Partida]  WITH CHECK ADD  CONSTRAINT [FK_Partida_CalendarioItem] FOREIGN KEY([CalendarioItemID])
REFERENCES [dbo].[CalendarioItem] ([CalendarioItemID])
GO
ALTER TABLE [dbo].[Partida] CHECK CONSTRAINT [FK_Partida_CalendarioItem]
GO
/****** Object:  ForeignKey [FK_Partida_Campeonato]    Script Date: 08/12/2008 22:58:59 ******/
ALTER TABLE [dbo].[Partida]  WITH CHECK ADD  CONSTRAINT [FK_Partida_Campeonato] FOREIGN KEY([CampeonatoID])
REFERENCES [dbo].[Campeonato] ([CampeonatoID])
GO
ALTER TABLE [dbo].[Partida] CHECK CONSTRAINT [FK_Partida_Campeonato]
GO
/****** Object:  ForeignKey [FK_Partida_Time]    Script Date: 08/12/2008 22:58:59 ******/
ALTER TABLE [dbo].[Partida]  WITH CHECK ADD  CONSTRAINT [FK_Partida_Time] FOREIGN KEY([TimeCasaID])
REFERENCES [dbo].[Time] ([TimeID])
GO
ALTER TABLE [dbo].[Partida] CHECK CONSTRAINT [FK_Partida_Time]
GO
/****** Object:  ForeignKey [FK_Partida_Time1]    Script Date: 08/12/2008 22:58:59 ******/
ALTER TABLE [dbo].[Partida]  WITH CHECK ADD  CONSTRAINT [FK_Partida_Time1] FOREIGN KEY([TimeVisitanteID])
REFERENCES [dbo].[Time] ([TimeID])
GO
ALTER TABLE [dbo].[Partida] CHECK CONSTRAINT [FK_Partida_Time1]
GO
/****** Object:  ForeignKey [FK_PartidaCartao_Partida]    Script Date: 08/12/2008 22:58:59 ******/
ALTER TABLE [dbo].[PartidaCartao]  WITH CHECK ADD  CONSTRAINT [FK_PartidaCartao_Partida] FOREIGN KEY([PartidaID])
REFERENCES [dbo].[Partida] ([PartidaID])
GO
ALTER TABLE [dbo].[PartidaCartao] CHECK CONSTRAINT [FK_PartidaCartao_Partida]
GO
/****** Object:  ForeignKey [FK_PartidaGol_Partida]    Script Date: 08/12/2008 22:58:59 ******/
ALTER TABLE [dbo].[PartidaGol]  WITH CHECK ADD  CONSTRAINT [FK_PartidaGol_Partida] FOREIGN KEY([PartidaID])
REFERENCES [dbo].[Partida] ([PartidaID])
GO
ALTER TABLE [dbo].[PartidaGol] CHECK CONSTRAINT [FK_PartidaGol_Partida]
GO
/****** Object:  ForeignKey [FK_PartidaProfissional_Partida]    Script Date: 08/12/2008 22:58:59 ******/
ALTER TABLE [dbo].[PartidaProfissional]  WITH CHECK ADD  CONSTRAINT [FK_PartidaProfissional_Partida] FOREIGN KEY([PartidaID])
REFERENCES [dbo].[Partida] ([PartidaID])
GO
ALTER TABLE [dbo].[PartidaProfissional] CHECK CONSTRAINT [FK_PartidaProfissional_Partida]
GO
/****** Object:  ForeignKey [FK_PartidaProfissional_Profissional]    Script Date: 08/12/2008 22:58:59 ******/
ALTER TABLE [dbo].[PartidaProfissional]  WITH CHECK ADD  CONSTRAINT [FK_PartidaProfissional_Profissional] FOREIGN KEY([ProfissionalID])
REFERENCES [dbo].[Profissional] ([ProfissionalID])
GO
ALTER TABLE [dbo].[PartidaProfissional] CHECK CONSTRAINT [FK_PartidaProfissional_Profissional]
GO
/****** Object:  ForeignKey [FK_Profissional_Posicao]    Script Date: 08/12/2008 22:59:00 ******/
ALTER TABLE [dbo].[Profissional]  WITH CHECK ADD  CONSTRAINT [FK_Profissional_Posicao] FOREIGN KEY([PosicaoID])
REFERENCES [dbo].[Posicao] ([PosicaoID])
GO
ALTER TABLE [dbo].[Profissional] CHECK CONSTRAINT [FK_Profissional_Posicao]
GO
/****** Object:  ForeignKey [FK_Time_TimeEmblema]    Script Date: 08/12/2008 22:59:00 ******/
ALTER TABLE [dbo].[Time]  WITH CHECK ADD  CONSTRAINT [FK_Time_TimeEmblema] FOREIGN KEY([TimeEmblemaID])
REFERENCES [dbo].[TimeEmblema] ([TimeEmblemaID])
GO
ALTER TABLE [dbo].[Time] CHECK CONSTRAINT [FK_Time_TimeEmblema]
GO
/****** Object:  ForeignKey [FK_Time_TimeMascote]    Script Date: 08/12/2008 22:59:00 ******/
ALTER TABLE [dbo].[Time]  WITH CHECK ADD  CONSTRAINT [FK_Time_TimeMascote] FOREIGN KEY([TimeMascoteID])
REFERENCES [dbo].[TimeMascote] ([TimeMascoteID])
GO
ALTER TABLE [dbo].[Time] CHECK CONSTRAINT [FK_Time_TimeMascote]
GO
/****** Object:  ForeignKey [FK_TimeProfissional_Profissional]    Script Date: 08/12/2008 22:59:00 ******/
ALTER TABLE [dbo].[TimeProfissional]  WITH CHECK ADD  CONSTRAINT [FK_TimeProfissional_Profissional] FOREIGN KEY([ProfissionalID])
REFERENCES [dbo].[Profissional] ([ProfissionalID])
GO
ALTER TABLE [dbo].[TimeProfissional] CHECK CONSTRAINT [FK_TimeProfissional_Profissional]
GO
/****** Object:  ForeignKey [FK_TimeProfissional_Time]    Script Date: 08/12/2008 22:59:00 ******/
ALTER TABLE [dbo].[TimeProfissional]  WITH CHECK ADD  CONSTRAINT [FK_TimeProfissional_Time] FOREIGN KEY([TimeID])
REFERENCES [dbo].[Time] ([TimeID])
GO
ALTER TABLE [dbo].[TimeProfissional] CHECK CONSTRAINT [FK_TimeProfissional_Time]
GO
